--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit e800ce054b55f9ded6d83d3ac4e6aeb81cda5bc3
Parents : 70b8ebe
Author : Mark Qvist <mark@unsigned.io>
Date : 2024-03-19T11:05:00+01:00
Added message transfer progress indication
Changes
2 files changed, 21 insertions(+), 0 deletions(-)
Diff
diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py
index bacd5989..47258f91 100644
--- a/sbapp/sideband/core.py
+++ b/sbapp/sideband/core.py
@@ -3248,6 +3248,13 @@ class SidebandCore():
RNS.log("Error while creating paper message: "+str(e), RNS.LOG_ERROR)
return False
+ def get_lxm_progress(self, lxm_hash):
+ try:
+ return self.message_router.get_outbound_progress(lxm_hash)
+ except Exception as e:
+ RNS.log("An error occurred while getting message transfer progress: "+str(e), RNS.LOG_ERROR)
+ return None
+
def send_message(self, content, destination_hash, propagation, skip_fields=False, no_display=False, attachment = None, image = None, audio = None):
try:
if content == "":
diff --git a/sbapp/ui/messages.py b/sbapp/ui/messages.py
index 97160c94..c83387cf 100644
--- a/sbapp/ui/messages.py
+++ b/sbapp/ui/messages.py
@@ -135,6 +135,20 @@ class Messages():
if m["state"] == LXMF.LXMessage.SENDING or m["state"] == LXMF.LXMessage.OUTBOUND:
msg = self.app.sideband.message(m["hash"])
+
+ if msg["state"] == LXMF.LXMessage.OUTBOUND or msg["state"] == LXMF.LXMessage.SENDING:
+ w.md_bg_color = msg_color = mdc(color_unknown, intensity_msgs)
+ txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
+ titlestr = ""
+ prgstr = ""
+ prg = self.app.sideband.get_lxm_progress(msg["hash"])
+ if prg != None:
+ prgstr = ", "+str(round(prg*100, 1))+"% progress"
+ if msg["title"]:
+ titlestr = "[b]Title[/b] "+msg["title"].decode("utf-8")+"\n"
+ w.heading = titlestr+"[b]Sent[/b] "+txstr+"\n[b]State[/b] Sending"+prgstr+" "
+ m["state"] = msg["state"]
+
if msg["state"] == LXMF.LXMessage.DELIVERED:
w.md_bg_color = msg_color = mdc(color_delivered, intensity_msgs)
txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────